import type { InputNumberProps, FormItemRule } from "element-plus";
import type { h } from "vue";

export interface BaseProps {
  type: string;
  key: string;
  label: string;
  labelWidth?: string | number;
  slot?: boolean; // 是否使用插槽
  compLabel?: string; // 组件的 label 属性
  placeholder?: string;
  inType?: string; // 组件的 type 属性
  span?: number;
  defaultValue?: string | number | boolean;
  required?: boolean;
  rules?: Array<FormItemRule>;
  hidden?: boolean;
  behindRender?: typeof h;

  [key: string]: any;
}

export interface inputProps extends BaseProps {
  type: "input";
}

export type numberProps = Partial<Exclude<InputNumberProps, BaseProps>> &
  BaseProps & {
    type: "number";
  };

// export interface numberProps extends BaseProps, ElInputNumberProps {
//   type: "number";
// }

export interface dateProps extends BaseProps {
  type: "date";
  rangeSeparator?: string;
  startPlaceholder?: string;
  endPlaceholder?: string;
  prefixIcon?: string | any;
}

export interface selectProps extends BaseProps {
  type: "select";
  labelKey: string;
  valueKey: string;
  columns?: columnsType[];
  options: { [key: PropertyKey]: any }[];
}

export type columnsType = {
  key: string;
  name: string;
  width?: string;
};
